import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    Animate: "", //localStorage.getItem("animate") || 
    userInfo: JSON.parse(localStorage.getItem("userInfo")) || "",
    colorIndex: localStorage.getItem("color") || 0,
    colorItem: [
      {
        color: '#FF4500',
        bgColor: 'linear-gradient(to right,#FF4500,#FF5400)',
        name: '橙色'
      },
      {
        color: '#0369FF',
        bgColor: 'linear-gradient(to right,#0369FF,#0396FF)',
        name: '蓝色'
      },
      {
        color: '#32CCBC',
        bgColor: 'linear-gradient(to right,#32CCBC,#32DDBC)',
        name: '青色'
      },
      {
        color: '#F6146C',
        bgColor: 'linear-gradient(to right,#F6146C,#F6416C)',
        name: '红色'
      },
      {
        color: '#FF7C9E',
        bgColor: 'linear-gradient(to right,#FF7C9E,#FFC79E)',
        name: '粉色'
      }
    ]
  },
  mutations: {
    setUserInfo(state,value) {
      localStorage.setItem('userInfo',JSON.stringify(value))
      state.userInfo = value
    },
    editColor(state,index) {
      localStorage.setItem('color',index)
      state.colorIndex = index
    },
    setAnimate(state,value) {
      //localStorage.setItem('animate',value)
      state.Animate = value
    }
  },
  getters: {
  },
  actions: {},
  modules: {
  }
})
